package systempen.cmanager;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class ListAdapterDialogTypeBrowser extends ArrayAdapter<ListItemDialogTypeBrowser> {
 
    private List<ListItemDialogTypeBrowser> items;
 
    public ListAdapterDialogTypeBrowser(Context context, int textViewResourceId, List<ListItemDialogTypeBrowser> items) {
        super(context, textViewResourceId, items);
        this.items = items;
    }
 
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        if (v == null) {
            LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
                    Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.item_dialog_type_browser, null);
        }
        ListItemDialogTypeBrowser o = items.get(position);
        if (o != null) {
            TextView tc = (TextView) v.findViewById(R.id.ctcode);
            if (tc != null) {
                tc.setText(o.getCode());
            }
            
            TextView tOpis = (TextView) v.findViewById(R.id.codetext);
            if (tOpis!= null){
            	tOpis.setText(o.getOpis());
            }
            
        }
        return v;
    }
}